<%@ Register TagPrefix="uc1" TagName="Header" Src="../Controls/Header.ascx" %>
<%@ Register TagPrefix="uc1" TagName="Footer" Src="../Controls/Footer.ascx" %>
<%@ Page Language="vb" AutoEventWireup="false" Codebehind="OrderHistoryReportByProduct.aspx.vb" Inherits="MIMS_WRS.Web.OrderHistoryReportByProduct"%>
<%@ Register TagPrefix="uc1" TagName="ReportFunctionsLinkCtrl" Src="../Controls/ReportFunctionsLinkCtrl.ascx" %>
<%@ Register TagPrefix="uc1" TagName="OrderHistoryReportByProductCtrl" Src="../Controls/OrderHistoryReportByProductCtrl.ascx" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
	<HEAD>
		<title>Order History Report By Product</title>
		<meta name="GENERATOR" content="Microsoft Visual Studio .NET 7.1">
		<meta name="CODE_LANGUAGE" content="Visual Basic .NET 7.1">
		<meta name="vs_defaultClientScript" content="JavaScript">
		<meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
		<script language="javascript" src="../Js/popcalendar.js"></script>
		<script language="javascript" src="../Js/common.js"></script>
		<LINK href="../style.css" type="text/css" rel="stylesheet">
		<script language="JavaScript" src="../js/function.js" type="text/JavaScript"></script>
		<script event="onclick" for="imgBtnGo">
			var txtFromDate = window.document.getElementById('txtFromDate');
			var txtToDate = window.document.getElementById('txtToDate');
			var txtProductCode = window.document.getElementById('txtProductCode');
			
			//if(isNaN(txtProductCode.value))
			//	return false;
				
			if(txtFromDate.value == "")
				return true;	
						
			if(!CompareDate(txtFromDate, txtToDate))
			{
				alert('"To date" must be greater than or equal to "From date"');
				return false;
			}			
		</script>
		<script language="javascript">
		var months = new Array("Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec");
		function FindMonths(mth) 
		{
			var i;
			for (i=0; i<12; i++) 
				if (months[i]==mth)
					return i+1;
			return 0;
		}
		
		function CompareDate(txtdate1, txtdate2) 
		{							
			// format of date: dd/MMM/yy   ex: 02/Jan/2003
			// date2 must be greater than or equal date1			
			
			if (txtdate2 == null || txtdate1 == null) 
				return false;
			else {			
				if (txtdate2.value == "" || txtdate1.value == "")
					return false;
				var d1 = parseInt(txtdate1.value.substr(0, 2) , 10)					
				var d2 = parseInt(txtdate2.value.substr(0, 2) , 10)
				var m1 = FindMonths(txtdate1.value.substr(3, 3))
				var m2 = FindMonths(txtdate2.value.substr(3, 3))
				var y1 = parseInt(txtdate1.value.substr(7, 4) , 10)
				var y2 = parseInt(txtdate2.value.substr(7, 4) , 10)					
				return ((y2>y1) || (y2==y1 && m2>m1) || (y2==y1 && m2==m1 && d2>=d1))
			}				
		}

		</script>
	</HEAD>
	<body MS_POSITIONING="GridLayout" leftMargin="0" topMargin="0" onload="MM_preloadImages('../images/b_weeklyreporto.gif','../images/b_historyreporto.gif','../images/b_usero.gif')"
		marginheight="0" marginwidth="0">
		<form id="Form1" method="post" runat="server">
			<table cellSpacing="0" cellPadding="0" width="100%" border="0">
				<uc1:Header id="Header1" runat="server"></uc1:Header>
				<!-- Submenu: start -->
				<tr>
					<td>
						<table id="Table1" cellSpacing="0" cellPadding="0" width="100%" border="0">
							<tr>
								<td class="bgsubmenu" align="center" height="30">
									<table width="96%" border="0" cellpadding="0" cellspacing="0">
										<tr>
											<%= ReportListLink%>
											<td width="70" align="right" nowrap class="txtcolor2"><span class="plink"><a href="javascript:history.back()"><img src="../images/b_back.gif" width="57" height="16" hspace="2" vspace="0" border="0"></a></span></td>
										</tr>
									</table>
								</td>
							</tr>
							<tr>
								<td class="bglinetop1" height="1"><IMG height="1" src="../images/1pxl.gif" width="1"></td>
							</tr>
							<tr>
								<td height="350" align="center" valign="top" class="bgwhite"><table width="96%" border="0" cellspacing="0" cellpadding="0">
										<tr>
											<td><table width="100%" border="0" cellpadding="0" cellspacing="0">
													<tr valign="bottom">
														<td height="25"><span class="title"><strong> HISTORY REPORT BY PRODUCT</strong></span></td>
														<td align="right"><div class="plink">
																<div class="plink">
																	<strong><span class="txtsmall">
																			<uc1:ReportFunctionsLinkCtrl id="ReportFunctionsLinkCtrl1" runat="server"></uc1:ReportFunctionsLinkCtrl></span></strong></div>
															</div>
														</td>
													</tr>
												</table>
											</td>
										</tr>
										<tr>
											<td height="5"><img src="../images/1pxl.gif" width="1" height="1"></td>
										</tr>
										<tr>
											<td height="1" class="line"><img src="../images/1pxl.gif" width="1" height="2"></td>
										</tr>
										<tr>
											<td height="25" align="right" class="bgtitle"><table width="100%" border="0" cellspacing="0" cellpadding="0">
													<tr>
														<td>
															<table border="0" cellspacing="0" cellpadding="2">
																<tr>
																	<td><table border="0" cellspacing="0" cellpadding="0">
																			<tr>
																				<td class="txtnormal"><strong>Departure Date: </strong>from<strong>&nbsp;</strong></td>
																				<td class="txtnormal"><asp:TextBox id="txtFromDate" runat="server" Width="98px" CssClass="txtsmall"></asp:TextBox>
																				</td>
																				<td class="txtnormal"><a onclick="popUpCalendar(this, window.document.getElementById('txtFromDate'), '<%= MIMS_WRS.Business.Common.GetDateFormat %>')" href="javascript:doNothing()"><img src="../images/b_date.gif" width="22" height="20" hspace="2" border="0"></a></td>
																				<td width="10" class="txtnormal">&nbsp;</td>
																				<td width="20" class="txtnormal">to</td>
																				<td class="txtnormal"><asp:TextBox id="txtToDate" runat="server" Width="104px" CssClass="txtsmall"></asp:TextBox>
																				</td>
																				<td><a onclick="popUpCalendar(this, window.document.getElementById('txtToDate'), '<%= MIMS_WRS.Business.Common.GetDateFormat %>')" href="javascript:doNothing()"><img src="../images/b_date.gif" width="22" height="20" hspace="2" border="0"></a></td>
																				<td width="10">&nbsp;</td>
																				<td><span class="txtnormal"><strong>Product Code: </strong></span>
																				</td>
																				<td>&nbsp;</td>
																				<td><asp:TextBox id="txtProductCode" runat="server" CssClass="txtsmall"
																						Width="98px" MaxLength="10"></asp:TextBox></td>
																				<td>&nbsp;</td>
																				<td><strong><asp:ImageButton id="imgBtnGo" runat="server" ImageUrl="../images/b_go.gif" width="30" height="20"
																							border="0"></asp:ImageButton></strong>
																							</td>
																			</tr>
																			<tr>
																				<td colspan='13' align="right">
																					<asp:regularexpressionvalidator id="RegularExpressionValidator1" runat="server" CssClass="txthighlight" ErrorMessage='must be 3-10 alphanumeric plus "/", "_", "-", "."'
																						Display="Dynamic" ControlToValidate="txtProductCode" ValidationExpression="([_0-9a-zA-Z\/\-\.]){3,10}"></asp:regularexpressionvalidator></td>
																			</tr>
																		</table>
																	</td>
																</tr>
															</table>
														</td>
													</tr>
													<tr>
														<td><table border="0" cellspacing="0" cellpadding="2">
																<tr>
																	<td class="txtnormal"><strong><strong>Customer:</strong></strong><span class="txtcolor2"><strong><strong>
																					<asp:Label id="lblCustomerName" runat="server"></asp:Label></strong></strong></span></td>
																</tr>
															</table>
														</td>
													</tr>
												</table>
											</td>
										</tr>
										<tr>
											<td valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0" class="border">
													<tr>
														<td valign="top">
															<uc1:OrderHistoryReportByProductCtrl id="OrderHistoryReportByProductCtrl1" runat="server"></uc1:OrderHistoryReportByProductCtrl>
														</td>
													</tr>
												</table>
											</td>
										</tr>
										<tr>
											<td><table width="100%" border="0" cellspacing="0" cellpadding="0">
													<tr>
														<td height="1" bgcolor="#ffffff" class="txtcolor1s"><img src="../images/1pxl.gif" width="1" height="1"></td>
													</tr>
													<tr>
														<td height="25" class="rowpage"><table width="100%" border="0" cellpadding="0" cellspacing="0">
																<tr>
																	<td width="44%" height="25">
																		<span class="txtcolor1"></span><span class="txtsmall"><strong>TOTAL: </strong></span>
																		<span class="txthighlight">
																			<asp:Label id="lblTotalNumber" runat="server"></asp:Label></span><span class="txtsmall"><strong>
																				<asp:Label id="lblTotalLabel" runat="server"></asp:Label></strong></span><span class="txtcolor1">
																		</span>
																	</td>
																	<td width="56%" align="right">
																	</td>
																</tr>
															</table>
														</td>
													</tr>
													<tr>
														<td height="1" class="border"><img src="../images/1pxl.gif" width="1" height="1"></td>
													</tr>
												</table>
											</td>
										</tr>
										<tr>
											<td align="right">&nbsp;</td>
										</tr>
									</table>
								</td>
							</tr>
							<tr>
								<td align="right">&nbsp;</td>
							</tr>
						</table>
					</td>
				</tr>
				<uc1:Footer id="Footer1" runat="server"></uc1:Footer>
			</table>
		</form>
	</body>
</HTML>
